<template>
  <footer class="footer">

    <span class="todo-count">剩余 <strong>{{ shengyu }}</strong></span>
    <ul class="filters">
      <li>
        <a @click="$emit('changeFlag', 'all')" :class="{selected: flag === 'all'}" href="#/">全部任务</a>
      </li>
      <li>
        <a @click="$emit('changeFlag', 'active')" :class="{selected: flag === 'active'}" href="#/active">进行中</a>
      </li>
      <li>
        <a @click="$emit('changeFlag', 'completed')" :class="{selected: flag === 'completed'}" href="#/completed">已完成</a>
      </li>
    </ul>

    <button class="clear-completed" @click="$emit('delCompleted')">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: {
    list: Array,
    flag: String
  },
  // 计算属性
  computed: {
    shengyu () {
      // return '计算的结果'
      return this.list.filter(item => item.isDone===false).length
    }
  }
}
</script>
  
  <style>
</style>